<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<script>
function fun(arr){
    //弄一个空数组
    var result=[];
    for(var i=0;i<arr.length;i++){
        //console.log(typeof arr[i]);
        if(typeof arr[i]=='object'){
            //a,b,c+
            result=result.concat(fun(arr[i]));
        }else{
            result.push(arr[i]);
        }
        
    }
    //最后返回改变后的数组
    return result;
}
console.log(fun(['a','b','c',['d','e']]));

</script>
</body>
</html>